package com.css.modules.lawRepo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.css.common.utils.PageUtils;
import com.css.modules.lawRepo.entity.LawRepoLegalCategoryTEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface LawRepoLegalCategoryTDao extends BaseMapper<LawRepoLegalCategoryTEntity> {
    @Select("select * from LAW_REPO_LEGAL_CATEGORY_T")
    PageUtils queryPage(Map<String, Object> params);

    @Select("select * from LAW_REPO_LEGAL_CATEGORY_T where KEYWORDS=#{keywords}")
    LawRepoLegalCategoryTEntity findByKeywords(String keywords);

    int commonUpdateDelFlagBatch(Map<String, Object> map);
    @Select("select * from LAW_REPO_LEGAL_CATEGORY_T where parent_id = #{uuid}")
    List<LawRepoLegalCategoryTEntity> findAllChildren(@Param("uuid") String uuid);


    @Select("select * from \"NEWLAW\".\"LAW_REPO_LEGAL_CATEGORY_T\"\n" +
            " where parent_id = \n" +
            " (select tablerowguid from \"NEWLAW\".\"LAW_REPO_LEGAL_CATEGORY_T\"\n" +
            "  where name = #{name} \n" +
            " );")
    List<LawRepoLegalCategoryTEntity> findChildrenByName(@Param("name")String name);
}
